import React, { useEffect, useState } from 'react'
import User_title from './Component/User_title'
import Flushed from '../../Monitoring_analytics/Operate_monitor/Component/Flushed'
import User_content from './Component/User_content'
import { getuserlabel } from '../../../request/api'
export default function User_tags() {
    useEffect(() => {
        Getuserlabel()
    }, [])
    const [usedata, setusedata] = useState<any>([])
    const Getuserlabel = async () => {
        const res = await getuserlabel({})
        if (res.code == 200) {
            setusedata(res.data)
        }
    }
    // 获取子组件传递的搜索完后的数据信息，更新用户信息
    const getTitle = (item: any) => {
        console.log(item);
        setusedata(item)
    }
    // 添加用户标签之后获取最新的用户数据
    const getuserlist = (item: any) => {
        if (item == 200) {
            Getuserlabel()
        }
    }

    return (
        <div>
            <User_title getTitle={getTitle} getuserlist={getuserlist}></User_title>
            <Flushed></Flushed>
            <div style={{ width: '100%', backgroundColor: 'white', padding: '0.5rem', marginTop: '0.5rem' }}>
                <User_content userdata={usedata} getTitle={getTitle} getuserlist={getuserlist} ></User_content>
            </div>
        </div>
    )
}
